import { createSlice } from '@reduxjs/toolkit'

export const citys = createSlice({
  name: 'citys',
  initialState: {
   start:'北京',
   end:'上海'
  },
  reducers: {
    setCity(state,{payload:{type,city}}){
        state[type]=city
    },
    exChange(state){
    let temp=state.start
    state.start=state.end
    state.end=temp
    }
  },
})

// Action creators are generated for each case reducer function
export const { setCity, exChange } = citys.actions

export default citys.reducer